package com.zx.erp.sys.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zx.erp.sys.bean.Area;
import com.zx.erp.sys.bean.City;
import com.zx.erp.sys.bean.Province;
import com.zx.erp.sys.mapper.AreaDao;
import com.zx.erp.sys.service.AreaBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AreaBizImpl implements AreaBiz {
    @Autowired
    private AreaDao adao;

    @Override
    public List<Province> findAllProvince() {
        return adao.findAllProvince();
    }

    @Override
    public Province findProvinceByPid(Integer pid) {
        return adao.findProvinceByPid(pid);
    }

    @Override
    public List<City> findCitiesByPid(Integer pid) {
        return adao.findCitiesByPid(pid);
    }

    @Override
    public List<City> findAllCities() {
        return adao.findAllCities();
    }

    @Override
    public City findCityByCid(Integer cid) {
        return adao.findCityByCid(cid);
    }

    @Override
    public PageInfo<Area> findProvinceAndCity(String pName, String cName, Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        List<Area> alist = adao.findProvinceAndCity(pName, cName);
        PageInfo<Area> pageInfo = new PageInfo<Area>(alist);
        return pageInfo;
    }
}
